# 作者：陈睿-cruise
# 2025年02月19日12时31分18秒
# 2979386061@qq.com
import multiprocessing
import os
def sing(num):
    print('sing:',os.getpid(),os.getppid())
    for i in range(num):
        print(f'song')

def speak(count):
    print('speak:', os.getpid(), os.getppid())
    for i in range(count):
        print(f'something')

if __name__ == '__main__':
    print('main:',os.getpid())
    # 创建sing进程并传递位置参数 (5)
    sing_process=multiprocessing.Process(target=sing(),args=(5,))
    # 创建speak进程并传递关键字参数 (count=6)
    speak_process=multiprocessing.Process(target=speak(),kwargs={'count':6})
    # 启动进程
    speak_process.start()
    sing_process.start()
    # 等待进程结束
    speak_process.join()
    sing_process.join()

    print('All processes are done!')

